var htmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
var webpack = require('webpack');

module.exports = {
    entry : {
        index : ['./app/index.js'],
    },
    output : {
        filename : 'js/[name].js',
        path    : path.resolve(__dirname,'dist')
    },
    module : {
        rules : [
            {
                test : /\.js$/,
                loaders : ['babel-loader?cacheDirectory=true']
            },
            {
                test : /\.css$/,
                loader : ['style-loader','css-loader']
            }
        ]
    },
    plugins : [
        new htmlWebpackPlugin({
            template : './app/index.html',
            chunks : ['index'],
            filename : 'index.html',    //相对于output的path
            title : 'index',
            inject : 'body'
        })
    ]
}